<?php
namespace Lm\Models;
//该model废弃，使用common下的model，by qgz 20181220
class XHLmRentPay extends basicModel
{

    /**
     *
     * @var integer
     * @Primary
     * @Column(type="integer", length=11, nullable=false)
     */
    public $iRPId;

    /**
     * @var integer
     */
    public $iRHId;

    /**
     * @var string
     */
    public $tStartDate;

    /**
     * @var string
     */
    public $tEndDate;

    /**
     * @var integer
     */
    public $iMonthPay;


    /**
     * @var integer
     */
    public $iCashPledge;


    /**
     * @var integer
     */
    public $iAgencyFee;

    /**
     * @var integer
     */
    public $iTaxes;

    /**
     * @var integer
     */
    public $iTotal;

    /**
     * @var integer
     */
    public $iState;

    /**
     * @var string
     */
    public $mDesc;

    /**
     *
     * @var integer
     * @Column(type="integer", length=4, nullable=true)
     */
    public $bDelete;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tCreateDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=20, nullable=true)
     */
    public $iCreateUserId;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tLastModifyDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $iLastModifyUserId;

    /**
     * 是否报销
     * @var integer
     * @Column(type="integer", length=4, nullable=true)
     * create by dale 20180816
     */
    public $bReimburse;

    /**
     * 报销相关记录
     * @var string
     * @Column(type="string", nullable=true)
     * create by dale 20180816
     */
    public $mReimburse;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource("XHLm_RentPay");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'XHLm_RentPay';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return XHLmRentPay[]|XHLmRentPay|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return XHLmRentPay|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    public function afterFetch()
    {
        $this->mReimburse = $this->mReimburse ? unserialize($this->mReimburse) : [];
    }


    public function beforeSave()
    {
        $this->mReimburse = serialize($this->mReimburse);
    }

}
